﻿
namespace Cos.Core.NHibernate.Util
{
    using System.Collections.Generic;

    using Cos.Core.Model.Media;

    /// <summary>
    /// Convert the models/objects in the Media group
    /// </summary>
    public static class MediaModelConverter
    {
        /// <summary>
        /// Converts a VideoDataModel object to a Video object.
        /// </summary>
        /// <param name="videoDataModel">the original object that needs to be converted.</param>
        /// <param name="cultureCode">The culture code.</param>
        /// <param name="isLiveMode">Is live mode?</param>
        /// <returns>A Video object.</returns>
        public static Video ToVideo(this VideoDataModel videoDataModel, string cultureCode, bool isLiveMode)
        {
            var video = new Video();
            video.CultureCode = cultureCode;

            video.Id = videoDataModel.Id;
            video.OriginalCultureCode = videoDataModel.OriginalCultureCode;

            return video;
        }

        /// <summary>
        /// Converts a Video object to a VideoDataModel object
        /// </summary>
        /// <param name="video">The video object that needs to be converted.</param>
        /// <param name="cultureCode">The culture code.</param>
        /// <param name="isLiveMode">Is live mode ?</param>
        /// <returns>A VideoDataModel object.</returns>
        public static VideoDataModel ToVideo(this Video video, string cultureCode, bool isLiveMode)
        {
            var videoDataModel = new VideoDataModel();
            videoDataModel.Id = video.Id;
            videoDataModel.IsExternal = video.IsExternal;
            videoDataModel.OriginalCultureCode = video.OriginalCultureCode;

            return videoDataModel;
        }
    }
}

